Upload (XForms API) |
The Upload control is used to upload files to server or to an application connector from any client location. It comprises an input field, a browse button, and a delete button. The default label is Attachment.
This control is derived from the Upload library. For details about the control's behavior and functionality, see Upload.
You can use the Message Map to create associations between this control and any required model. The mapping that you define between the control and the model is stored in a mapping object.
Properties, Events, and Methods of the Control
The properties, events, and methods associated with the Upload control define its behavior. You can set them either through the control's property sheet or programmatically using the APIs. For details, see Upload.
The following XForms-related properties are available for the control:
Table 1. List of Properties
Property |
Description |
---|---|
ID |
Sets the string that identifies the control on an XForm. If not specified, a unique ID is automatically generated. |
Sets or retrieves the class name applied on the control. |
|
Visible |
Sets a boolean value to specify whether the control will be displayed at run time or not. This property is useful when you handle the upload method through scripting. |
Model |
Sets the ID of the data model from which data (specified using the Reference property) is displayed in the control. If a model is not specified, it is inherited from the parent control's model. |
Sets the location or XPath that contains the data (value) displayed in the control. The XPath refers to the child node or descendants of the immediate parent control's reference. The referred node is updated with Upload:FileName1 as value in the Update request of the model. |
|
File Content Path |
Mandatory. Sets the location or XPath of the uploaded file in the updated business object. |
Request |
Sets the request for the control. For this, you can use a method available in the Workspace or provide a SOAP request that includes the SOAP:Envelope tag. In case, a model is set for the control, the SOAP request is not considered. |
Encode |
Boolean that specifies whether the uploaded files are to be encoded or not.
|
Timeout |
Integer that denotes the time (in milliseconds) that can be taken for the download method. |
XML Content |
Boolean that specifies whether the content of uploaded files is XML or not. This property is used only when the 'encode' is false.
|
Show Status |
Boolean that denotes whether the upload status is to be indicated or not.
|
The following XForms-related events are available for the control:
Table 2. List of Events
Event |
Description |
---|---|
onBeforeUpload |
Activated before uploading a file. |
onUpload |
Activated when a file is uploaded. |
The following XForms-related methods are available for the control:
Table 3. List of Methods
Method |
Description |
---|---|
Registers a function to an event, such that the function gets called when the event is fired on the control. |
|
Returns the original value of the control, as available in the database. |
|
Unregisters a function from an event, such that the function stops getting called when the event is fired on the control. |
|
setButtonLabel |
Sets the button name of the |
getButtonLabel |
Gets the button name of the |
clearPath | Clears the current file path from the upload control and sets the default message 'No file selected'. |